package com.wx.sign;


import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException;
import com.sun.org.apache.xml.internal.security.utils.Base64;

import javax.crypto.*;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

public class Test {

    private static String keys = "0123456789123456";
    private static String vectorKey = "0123456789123456";
    private static String str = "wangxiang";

    public static void main(String[] args) {
        try {

            // transformation
            // "algorithm/mode/padding" or
            // "algorithm"
            //
            String transformation = "AES/CBC/PKCS5Padding";
            Cipher cipher = Cipher.getInstance(transformation);
//            cipher.init(, );


            //工厂方法返回的对象没有进行初始化，因此在使用前必须进行初始化。
            //ENCRYPT_MODE,加密数据
            //
            //DECRYPT_MODE,解密数据
            //
            //WRAP_MODE,将一个Key封装成字节，可以用来进行安全传输
            //
            //UNWRAP_MODE,将前述已封装的密钥解开成java.security.Key对象
//            cipher.init(Cipher.WRAP_MODE, );


        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        } catch (NoSuchPaddingException e) {
            e.printStackTrace();
//        } catch (BadPaddingException e) {
//            e.printStackTrace();
//        } catch (IllegalBlockSizeException e) {
//            e.printStackTrace();
//        } catch (InvalidAlgorithmParameterException e) {
//            e.printStackTrace();
//        } catch (InvalidKeyException e) {
//            e.printStackTrace();
        }
    }

}
